<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/admincontent.jsp" %>
<div id="Content">
    <form id="modelform" class="layui-form" method="post" action="/SysAdmin/AddRoleAction">
        <div class="toolbars" lay-submit lay-filter="savedept">
            <a id="save">
                <em class="ico16 save_traft_16"></em>
                <span class="menu_span" title="保存">保存</span>
            </a>
        </div>
        <table class="treeTable inputform" style="margin-top: 10px">
            <tbody>
            <tr>
                <td width="80">部门编码：</td>
                <td>
                    <div><input type="text" name="code" required lay-verify="required"
                                <c:if test="${baseDepartment.code!=null}">disabled="true" value="${baseDepartment.code}"</c:if>/></div>
                </td>
            </tr>
            <tr>
                <td>部门名称：</td>
                <td>
                    <div><textarea name="name" required lay-verify="required"
                    ><c:if test="${baseDepartment.name!=null}">${baseDepartment.name}</c:if></textarea></div>
                </td>
            </tr>
            <tr>
                <td>部门全称：</td>
                <td>
                    <div><textarea name="fullname" required lay-verify="required"
                    ><c:if test="${baseDepartment.fullname!=null}">${baseDepartment.fullname}</c:if></textarea></div>
                </td>
            </tr>

            </tbody>
        </table>
    </form>
</div>
<script>
    layui.use("form", () => {
        let form = layui.form;
        form.on("submit(savedept)", function (data) {
            $.ajax({
                url: "/SysAdmin/${url}",
                type: "post",
                data: data.field,
                success: function(data) {
                    layer.msg(data.msg, {icon: 1, time: 2000});
                    setTimeout(()=>{
                        parent.location.reload();
                    }, 2000)
                },
                error: function (data) {
                    layer.msg(data.msg, {icon: 2});
                }
            })
        });
    })
</script>
</body>
</html>
